﻿using Microsoft.AspNetCore.Mvc;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace Webapi.Controllers
{
    public class LXYControllerBase:ControllerBase
    {
        /// <summary>
        /// 返回成功结果
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public IActionResult Success()
        {
            return Ok(new
            {
                code = 200
            });
        }
        /// <summary>
        /// 返回成功结果
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public IActionResult Success(object data)
        {
            return Ok(new
            {
                code = 200,
                message = "成功",
                data = data
            });
        }

        public IActionResult Success(string message)
        {
            return Ok(new
            {
                code = 200,
                message = message
            });
        }

        /// <summary>
        /// 返回成功结果
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public IActionResult Success(string message,object data)
        {
            return Ok(new
            {
                code = 200,
                message = message,
                data = data
            });
        }

        /// <summary>
        /// 返回错误信息
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public IActionResult Error(string message)
        {
            return Ok(new
            {
                code = 500,
                message = message
            });
        }

    }
}
